﻿namespace NTLib.Pipe.Exceptions
{
    using NTLib.Pipe.Descriptors;
    using NTLib.Pipe.Targets;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    /// <summary>
    /// Raised when the target is not found.
    /// </summary>
    public class TargetNotFoundException : PipeException
    {
        #region Fields

        private readonly ITargetDescriptor _target;

        #endregion

        #region Ctor

        /// <summary>
        /// Initializes a new instance of the <see cref="TargetNotFoundException"/> class.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="message">The error message that explains the reason for the exception.</param>
        /// <param name="innerException">The exception that is the cause of the current exception, or a null reference
        ///     (Nothing in Visual Basic) if no inner exception is specified.</param>
        public TargetNotFoundException(ITargetDescriptor target, string message = null, Exception innerException = null)
            : base(message, innerException)
        {
            this._target = target;
        }

        #endregion

        #region Property

        /// <summary>
        /// Gets the target.
        /// </summary>
        public ITargetDescriptor Target
        {
            get { return this._target; }
        }

        #endregion
    }
}
